libxc: fix claim mode when creating HVM guest
authorWei Liu <wei.liu2@citrix.com>
Mon, 27 Jan 2014 17:53:38 +0000 (17:53 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 4 Feb 2014 14:40:49 +0000 (14:40 +0000)
commit46b5f0fd1fe7a49fb993fbad8a1fa232e2253afc
tree2945e73a691bdb3d110c8414e9f23c578b14a10c
parent3f4218742f5efc7c89fc1c61af546942f9d2dbb8
libxc: fix claim mode when creating HVM guest

The original code is wrong because:
* claim mode wants to know the total number of pages needed while
  original code provides the additional number of pages needed.
* if pod is enabled memory will already be allocated by the time we try
  to claim memory.

So the fix would be:
* move claim mode before actual memory allocation.
* pass the right number of pages to hypervisor.

The "right number of pages" should be number of pages of target memory
minus VGA_HOLE_SIZE, regardless of whether PoD is enabled.

This fixes bug #32.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxc/xc_hvm_build_x86.c